/*
*	create by  jack ,20210705
*
*	描述 ：
*		  该文件提供了一套设备调用的接口，屏蔽具体实现细节,以达到应用程序可以在不同的平台上联合调试。
*		  open 返回该设备枚举类别。无设备实现时，返回负数.
*   修改记录：[内容][作者][时间]
*
*/


#ifndef _SANJI_OS_GPIO_H_
#define _SANJI_OS_GPIO_H_

#include "define_comm.h"
#include "device.h"
#include "file_operation.h"
#include "klist.h"

#include "rcc_apb_periph.h"


#ifdef __cplusplus
extern "C"{
#endif



struct gpio_pin
{
    sj_uint32 base;
    sj_uint32 pin;
    sj_uint32 mode;
    sj_uint32 speed;
    sj_uint32 pull;
};

sj_int8 sj_gpio_clock_config(struct rcc_apb_periph *apb);

sj_int8 sj_gpio_init(struct gpio_pin *gpio);

sj_int8 sj_iwdg_clock_config(struct rcc_lsi_periph *iwdg_lsi);

sj_void sj_iwdg_init(struct peripheral_iwdg *hiwdg);

sj_void sj_iwdg_feed(struct peripheral_iwdg *hiwdg);



sj_void rtc_update_time(RTC_TimeTypeDef stime, RTC_DateTypeDef date_update);//slj add

sj_void get_rtc_current_time(struct rtc_date *date, struct rtc_time *time); //slj add

#define sj_gpio_write(gpio,val) HAL_GPIO_WritePin((GPIO_TypeDef *)gpio->base,(0x01<<gpio->pin),val)

#define sj_gpio_read(gpio) HAL_GPIO_ReadPin((GPIO_TypeDef *)gpio->base,(0x01<<gpio->pin))


#ifdef __cplusplus
}
#endif
#endif
